{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 3a. Calculate fO2 from melt ST for a single melt composition from a dataframe using default options" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Python set-up\n", "You need to install VolFe once on your machine, if you haven't yet. Then we need to import a few Python packages (including VolFe)." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Install VolFe on your machine. Don't remove the # from this line!\n", "# pip install VolFe # Remove the first # in this line if you have not installed VolFe on your machine before.\n", "\n", "# import python packages\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import VolFe as vf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Define the inputs\n", "\n", "At a minimum to run an S-2-fO2 calculation, we need a dataframe of the melt composition and Fe in the melt [note 1], and temperature:\n", "\n", "- Sample is just the name for this analysis.\n", "\n", "- Temperature is in °C.\n", "\n", "- Volatile-free melt composition is in wt% oxides [note 2]. All these oxides must be present in the dataframe, so set them to 0. if you have no data for them (although see [note 1] around FeOT).\n", "\n", "- H2O is all hydrogen in the melt reported as H2O in wt% [note 3]. \n", "\n", "- CO2ppm is all carbon in the melt reported as CO2 in ppm [note 3].\n", "\n", "- STppm is all sulfur in the melt reported as S in ppm [note 3].\n", "\n", "- Xppm is all \"X\" in the melt reported as \"X\" in ppm [note 3]. \"X\" is an unreactive melt species whose identity can be changed - this is explored Example 1d.\n", "\n", "[note 1] In this example we specify Fe in the melt as FeOT - other options are possible, such as Fe2O3,T or FeO and Fe2O3.\n", "\n", "[note 2] It does not matter what the non-volatile oxides sum too - they are renormalised to 100 wt% minus the total of the volatiles (i.e., H2O + CO2 + ST + \"X\").\n", "\n", "[note 3] The volatile concentrations are absolute for the melt = i.e., the non-volatile melt composition is normalised to 100 wt% minus the volatiles. The volatiles are not added to the oxides and then renormalised.\n", "\n", "The following composition is analysis Sari15-04-34 from Brounce et al. (2014), with a temperature chosen as 1200 °C. We'll run at Pvsat (based on the volatile content) for now so we don't have to specify a P." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Sample T_C SiO2 TiO2 Al2O3 FeOT MnO MgO CaO Na2O \\\n", "0 Sari15-04-34 1200.0 46.94 0.65 16.0 8.92 0.15 7.3 13.94 1.61 \n", "\n", " K2O P2O5 H2O CO2ppm STppm Xppm \n", "0 0.26 0.07 3.83 1109.0 1614.12 0.0 \n" ] } ], "source": [ "# Define the melt composition and T as a dictionary.\n", "my_analysis = {'Sample':'Sari15-04-34',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'SiO2': 46.94, # wt%\n", " 'TiO2': 0.65, # wt%\n", " 'Al2O3': 16.0, # wt%\n", " 'FeOT': 8.92, # wt%\n", " 'MnO': 0.15, # wt%\n", " 'MgO': 7.3, # wt%\n", " 'CaO': 13.94, # wt%\n", " 'Na2O': 1.61, # wt%\n", " 'K2O': 0.26, # wt%\n", " 'P2O5': 0.07, # wt%\n", " 'H2O': 3.83, # wt%\n", " 'CO2ppm': 1109., # ppm\n", " 'STppm': 1614.12, # ppm\n", " 'Xppm': 0.} # ppm\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])\n", "\n", "# Show the DataFrame.\n", "print(my_analysis)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For this example we will use the default options in VolFe, which can be found below:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " option\n", "type \n", "COH_species yes_H2_CO_CH4_melt\n", "H2S_m True\n", "species X Ar\n", "Hspeciation none\n", "fO2 Kress91A\n", "... ...\n", "error 0.1\n", "print status False\n", "output csv True\n", "setup False\n", "high precision False\n", "\n", "[78 rows x 1 columns]\n" ] } ], "source": [ "# print default options in VolFe\n", "print(vf.default_models)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Run the calculation\n", "\n", "### At Pvsat\n", "\n", "And below runs the calculation - it outputs a dataframe of the full results. So in this example, the sample would be sulfide-saturated but doesn't have enough sulfur to be anhydrite saturated." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sampleT ('C)H2OT-eq_wtpcCO2T-eq_ppmwST_ppmwX_ppmwP (bar) sulfS2- SCSSsulfide saturated?DFMQ-sulfide...KHOSg optKOSg optKOSg2 optKCOg optKCOHg optKOCSg optKCOs optcarbonylsulfide optdensity optDate
0Sari15-04-341200.03.831109.01614.120.03209.6792761071.669795True0.905944...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 12:10:37.752486
\n", "

1 rows × 67 columns

\n", "
" ], "text/plain": [ "0 sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw \\\n", "0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 \n", "\n", "0 P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt \\\n", "0 3209.679276 1071.669795 True 0.905944 ... Ohmoto97 \n", "\n", "0 KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt \\\n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "\n", "0 carbonylsulfide opt density opt Date \n", "0 COS DensityX 2025-02-02 12:10:37.752486 \n", "\n", "[1 rows x 67 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# runs the calculation\n", "vf.calc_melt_S_oxybarometer(my_analysis)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### At specified P\n", "\n", "Alternatively, we can specify the pressure of the calculation by adding \"P_bar\" to the dataframe. \n", "\n", "The calculation is not iterative yet (work in progress) which means you also have to specify Fe3+/FeT of the melt so it can calculate S2-CSS and S6+CAS... \n", "\n", "Note that if this is below Pvsat for the volatile content, the melt composition is metastable because a vapor would be present, lowering the volatile content of the melt." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sampleT ('C)H2OT-eq_wtpcCO2T-eq_ppmwST_ppmwX_ppmwP (bar) sulfS2- SCSSsulfide saturated?DFMQ-sulfide...KHOSg optKOSg optKOSg2 optKCOg optKCOHg optKOCSg optKCOs optcarbonylsulfide optdensity optDate
0Sari15-04-341200.03.831109.01614.120.01000.0930.456494possible1.158861...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 09:58:12.197469
\n", "

1 rows × 67 columns

\n", "
" ], "text/plain": [ "0 sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw \\\n", "0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 \n", "\n", "0 P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt \\\n", "0 1000.0 930.456494 possible 1.158861 ... Ohmoto97 \n", "\n", "0 KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt \\\n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "\n", "0 carbonylsulfide opt density opt Date \n", "0 COS DensityX 2025-02-02 09:58:12.197469 \n", "\n", "[1 rows x 67 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Define the melt composition, P, and T as a dictionary.\n", "my_analysis = {'Sample':'Sari15-04-34',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'SiO2': 46.94, # wt%\n", " 'TiO2': 0.65, # wt%\n", " 'Al2O3': 16.0, # wt%\n", " 'FeOT': 8.92, # wt%\n", " 'MnO': 0.15, # wt%\n", " 'MgO': 7.3, # wt%\n", " 'CaO': 13.94, # wt%\n", " 'Na2O': 1.61, # wt%\n", " 'K2O': 0.26, # wt%\n", " 'P2O5': 0.07, # wt%\n", " 'H2O': 3.83, # wt%\n", " 'CO2ppm': 1109., # ppm\n", " 'STppm': 1614.12, # ppm\n", " 'Xppm': 0., # ppm\n", " 'P_bar': 1000., # bar\n", " 'Fe3FeT': 0.1} \n", "\t\t\t\t\t\t\t\t\t\t\t\t\t\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])\n", "\n", "# runs the calculation\n", "vf.calc_melt_S_oxybarometer(my_analysis)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Specifying sulfide composition\n", "\n", "The sulfide composition (i.e., fractions of Fe, Ni, and Cu) change the S2-CSS, which is incoporated into some parameterisations of S2-CSS (see Wieser & Gleeson, 2023, for an overview). \n", "\n", "If nothing about the sulfide composition is specified, VolFe assumes the sulfide is pure FeS. However, the composition of the sulfide can be specified in the input dataframe using \"sulf_XFe\", \"sulf_XCu\", and \"sulf_XNi\" as the mole fractions of FeS, CuS, and NiS in the sulfide, as shown below." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sampleT ('C)H2OT-eq_wtpcCO2T-eq_ppmwST_ppmwX_ppmwP (bar) sulfS2- SCSSsulfide saturated?DFMQ-sulfide...KHOSg optKOSg optKOSg2 optKCOg optKCOHg optKOCSg optKCOs optcarbonylsulfide optdensity optDate
0Sari15-04-341200.03.831109.01614.120.03223.517523867.284719True1.023231...Ohmoto97Ohmoto97ONeill22Ohmoto97Ohmoto97Moussallam19Holloway92COSDensityX2025-02-02 09:59:13.344561
\n", "

1 rows × 67 columns

\n", "
" ], "text/plain": [ "0 sample T ('C) H2OT-eq_wtpc CO2T-eq_ppmw ST_ppmw X_ppmw \\\n", "0 Sari15-04-34 1200.0 3.83 1109.0 1614.12 0.0 \n", "\n", "0 P (bar) sulf S2- SCSS sulfide saturated? DFMQ-sulfide ... KHOSg opt \\\n", "0 3223.517523 867.284719 True 1.023231 ... Ohmoto97 \n", "\n", "0 KOSg opt KOSg2 opt KCOg opt KCOHg opt KOCSg opt KCOs opt \\\n", "0 Ohmoto97 ONeill22 Ohmoto97 Ohmoto97 Moussallam19 Holloway92 \n", "\n", "0 carbonylsulfide opt density opt Date \n", "0 COS DensityX 2025-02-02 09:59:13.344561 \n", "\n", "[1 rows x 67 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Define the melt composition, sulfide composition, and T as a dictionary.\n", "my_analysis = {'Sample':'Sari15-04-34',\n", " 'T_C': 1200., # Temperature in 'C\n", " 'SiO2': 46.94, # wt%\n", " 'TiO2': 0.65, # wt%\n", " 'Al2O3': 16.0, # wt%\n", " 'FeOT': 8.92, # wt%\n", " 'MnO': 0.15, # wt%\n", " 'MgO': 7.3, # wt%\n", " 'CaO': 13.94, # wt%\n", " 'Na2O': 1.61, # wt%\n", " 'K2O': 0.26, # wt%\n", " 'P2O5': 0.07, # wt%\n", " 'H2O': 3.83, # wt%\n", " 'CO2ppm': 1109., # ppm\n", " 'STppm': 1614.12, # ppm\n", " 'Xppm': 0., # ppm\n", " 'sulf_XFe': 0.8,\n", " 'sulf_XCu': 0.15,\n", " 'sulf_XNi': 0.05}\n", "\t\t\t\t\t\t\t\t\t\t\t\t\t\n", "# Turn the dictionary into a pandas dataframe, setting the index to 0.\n", "my_analysis = pd.DataFrame(my_analysis, index=[0])\n", "\n", "# runs the calculation\n", "vf.calc_melt_S_oxybarometer(my_analysis)" ] } ], "metadata": { "kernelspec": { "display_name": "volfe-dev", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" } }, "nbformat": 4, "nbformat_minor": 2 }